home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / higemaru.c < prev    next >
C/C++ Source or Header  |  2000-04-04  |  8KB  |  257 lines

  1. /****************************************************************************
  2.  
  3. Higemaru
  4.  
  5. driver by Mirko Buffoni
  6.  
  7. ****************************************************************************/
  8.  
  9. #include "driver.h"
  10. #include "vidhrdw/generic.h"
  11.  
  12.  
  13. WRITE_HANDLER( higemaru_c800_w );
  14. void higemaru_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
  15. void higemaru_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  16.  
  17.  
  18.  
  19. int higemaru_interrupt(void)
  20. {
  21.     if (cpu_getiloops() == 0) return 0x00cf;    /* RST 08h */
  22.     else return 0x00d7;    /* RST 10h */
  23. }
  24.  
  25.  
  26.  
  27. static struct MemoryReadAddress readmem[] =
  28. {
  29.     { 0x0000, 0x7fff, MRA_ROM },
  30.     { 0xc000, 0xc000, input_port_0_r },
  31.     { 0xc001, 0xc001, input_port_1_r },
  32.     { 0xc002, 0xc002, input_port_2_r },
  33.     { 0xc003, 0xc003, input_port_3_r },
  34.     { 0xc004, 0xc004, input_port_4_r },
  35.     { 0xd000, 0xd7ff, MRA_RAM },
  36.     { 0xe000, 0xefff, MRA_RAM },
  37.     { -1 }    /* end of table */
  38. };
  39.  
  40. static struct MemoryWriteAddress writemem[] =
  41. {
  42.     { 0x0000, 0x7fff, MWA_ROM },
  43.     { 0xc800, 0xc800, higemaru_c800_w },
  44.     { 0xc801, 0xc801, AY8910_control_port_0_w },
  45.     { 0xc802, 0xc802, AY8910_write_port_0_w },
  46.     { 0xc803, 0xc803, AY8910_control_port_1_w },
  47.     { 0xc804, 0xc804, AY8910_write_port_1_w },
  48.     { 0xd000, 0xd3ff, videoram_w, &videoram, &videoram_size },
  49.     { 0xd400, 0xd7ff, colorram_w, &colorram },
  50.     { 0xd880, 0xd9ff, MWA_RAM, &spriteram, &spriteram_size },
  51.     { 0xe000, 0xefff, MWA_RAM },
  52.     { -1 }    /* end of table */
  53. };
  54.  
  55.  
  56.  
  57. INPUT_PORTS_START( higemaru )
  58.     PORT_START      /* IN0 */
  59.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_4WAY )
  60.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_4WAY )
  61.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_4WAY )
  62.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_4WAY )
  63.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
  64.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
  65.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  66.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  67.  
  68.     PORT_START      /* IN1 */
  69.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_4WAY | IPF_COCKTAIL )
  70.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_4WAY | IPF_COCKTAIL )
  71.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_4WAY | IPF_COCKTAIL )
  72.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_4WAY | IPF_COCKTAIL )
  73.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
  74.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
  75.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  76.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  77.  
  78.     PORT_START      /* IN2 */
  79.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
  80.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
  81.     PORT_DIPNAME( 0x04, 0x04, "Freeze" )    /* could be Tilt? */
  82.     PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
  83.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  84.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 )
  85.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
  86.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 )
  87.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
  88.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
  89.  
  90.     PORT_START      /* DSW0 */
  91.     PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) )
  92.     PORT_DIPSETTING(    0x01, DEF_STR( 5C_1C ) )
  93.     PORT_DIPSETTING(    0x02, DEF_STR( 4C_1C ) )
  94.     PORT_DIPSETTING(    0x03, DEF_STR( 3C_1C ) )
  95.     PORT_DIPSETTING(    0x04, DEF_STR( 2C_1C ) )
  96.     PORT_DIPSETTING(    0x07, DEF_STR( 1C_1C ) )
  97.     PORT_DIPSETTING(    0x06, DEF_STR( 1C_2C ) )
  98.     PORT_DIPSETTING(    0x05, DEF_STR( 1C_3C ) )
  99.     PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
  100.     PORT_DIPNAME( 0x38, 0x38, DEF_STR( Coin_B ) )
  101.     PORT_DIPSETTING(    0x08, DEF_STR( 5C_1C ) )
  102.     PORT_DIPSETTING(    0x10, DEF_STR( 4C_1C ) )
  103.     PORT_DIPSETTING(    0x18, DEF_STR( 3C_1C ) )
  104.     PORT_DIPSETTING(    0x20, DEF_STR( 2C_1C ) )
  105.     PORT_DIPSETTING(    0x38, DEF_STR( 1C_1C ) )
  106.     PORT_DIPSETTING(    0x30, DEF_STR( 1C_2C ) )
  107.     PORT_DIPSETTING(    0x28, DEF_STR( 1C_3C ) )
  108.     PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
  109.     PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Lives ) )
  110.     PORT_DIPSETTING(    0x80, "1" )
  111.     PORT_DIPSETTING(    0x40, "2" )
  112.     PORT_DIPSETTING(    0xc0, "3" )
  113.     PORT_DIPSETTING(    0x00, "5" )
  114.  
  115.     PORT_START      /* DSW1 */
  116.     PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )
  117.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  118.     PORT_DIPSETTING(    0x01, DEF_STR( Cocktail ) )
  119.     PORT_DIPNAME( 0x0e, 0x0e, DEF_STR( Bonus_Life ) )
  120.     PORT_DIPSETTING(    0x0e, "10000 50000 50000" )
  121.     PORT_DIPSETTING(    0x0c, "10000 60000 60000" )
  122.     PORT_DIPSETTING(    0x0a, "20000 60000 60000" )
  123.     PORT_DIPSETTING(    0x08, "20000 70000 70000" )
  124.     PORT_DIPSETTING(    0x06, "30000 70000 70000" )
  125.     PORT_DIPSETTING(    0x04, "30000 80000 80000" )
  126.     PORT_DIPSETTING(    0x02, "40000 100000 100000" )
  127.     PORT_DIPSETTING(    0x00, "None" )
  128.     PORT_DIPNAME( 0x10, 0x10, DEF_STR( Demo_Sounds ) )
  129.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  130.     PORT_DIPSETTING(    0x10, DEF_STR( On ) )
  131.     PORT_DIPNAME( 0x20, 0x20, "Demo Music" )
  132.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  133.     PORT_DIPSETTING(    0x20, DEF_STR( On ) )
  134.     PORT_DIPNAME( 0x40, 0x40, DEF_STR( Flip_Screen ) )
  135.     PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
  136.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  137.     PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
  138.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  139.     PORT_DIPSETTING(    0x80, DEF_STR( On ) )
  140. INPUT_PORTS_END
  141.  
  142.  
  143.  
  144. static struct GfxLayout charlayout =
  145. {
  146.     8,8,    /* 8*8 characters */
  147.     512,    /* 512 characters */
  148.     2,    /* 2 bits per pixel */
  149.     { 4, 0 },
  150.     { 0, 1, 2, 3, 8+0, 8+1, 8+2, 8+3 },
  151.     { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16 },
  152.     16*8    /* every char takes 16 consecutive bytes */
  153. };
  154. static struct GfxLayout spritelayout =
  155. {
  156.     16,16,    /* 16*16 sprites */
  157.     128,    /* 128 sprites */
  158.     4,        /* 4 bits per pixel */
  159.     { 128*64*8+4, 128*64*8, 4, 0 },
  160.     { 0, 1, 2, 3, 8+0, 8+1, 8+2, 8+3,
  161.             32*8+0, 32*8+1, 32*8+2, 32*8+3, 33*8+0, 33*8+1, 33*8+2, 33*8+3 },
  162.     { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16,
  163.             8*16, 9*16, 10*16, 11*16, 12*16, 13*16, 14*16, 15*16 },
  164.     64*8    /* every sprite takes 64 consecutive bytes */
  165. };
  166.  
  167. static struct GfxDecodeInfo gfxdecodeinfo[] =
  168. {
  169.     { REGION_GFX1, 0, &charlayout,       0, 32 },
  170.     { REGION_GFX2, 0, &spritelayout,  32*4, 16 },
  171.     { -1 } /* end of array */
  172. };
  173.  
  174.  
  175.  
  176. static struct AY8910interface ay8910_interface =
  177. {
  178.     2,    /* 2 chips */
  179.     12000000/8,    /* 1.5 MHz ? Main xtal is 12MHz */
  180.     { 25, 25 },
  181.     { 0 },
  182.     { 0 },
  183.     { 0 },
  184.     { 0 }
  185. };
  186.  
  187.  
  188.  
  189. static struct MachineDriver machine_driver_higemaru =
  190. {
  191.     /* basic machine hardware */
  192.     {
  193.         {
  194.             CPU_Z80,
  195.             4000000,    /* 4 MHz ? Main xtal is 12MHz */
  196.             readmem,writemem,0,0,
  197.             higemaru_interrupt,2
  198.         },
  199.     },
  200.     60, DEFAULT_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  201.     1,    /* single CPU, no need for interleaving */
  202.     0,
  203.  
  204.     /* video hardware */
  205.     32*8, 32*8, { 0*8, 32*8-1, 2*8, 30*8-1 },
  206.     gfxdecodeinfo,
  207.     32, 32*4+16*16,
  208.     higemaru_vh_convert_color_prom,
  209.  
  210.     VIDEO_TYPE_RASTER,
  211.     0,
  212.     generic_vh_start,
  213.     generic_vh_stop,
  214.     higemaru_vh_screenrefresh,
  215.  
  216.     /* sound hardware */
  217.     0,0,0,0,
  218.     {
  219.         {
  220.             SOUND_AY8910,
  221.             &ay8910_interface
  222.         }
  223.     }
  224. };
  225.  
  226.  
  227.  
  228. /***************************************************************************
  229.  
  230.   Game driver(s)
  231.  
  232. ***************************************************************************/
  233.  
  234. ROM_START( higemaru )
  235.     ROM_REGION( 0x1c000, REGION_CPU1 )    /* 64k for code */
  236.     ROM_LOAD( "hg4",          0x0000, 0x2000, 0xdc67a7f9 )
  237.     ROM_LOAD( "hg5",          0x2000, 0x2000, 0xf65a4b68 )
  238.     ROM_LOAD( "hg6",          0x4000, 0x2000, 0x5f5296aa )
  239.     ROM_LOAD( "hg7",          0x6000, 0x2000, 0xdc5d455d )
  240.  
  241.     ROM_REGION( 0x2000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  242.     ROM_LOAD( "hg3",          0x0000, 0x2000, 0xb37b88c8 )    /* characters */
  243.  
  244.     ROM_REGION( 0x4000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  245.     ROM_LOAD( "hg1",          0x0000, 0x2000, 0xef4c2f5d )    /* tiles */
  246.     ROM_LOAD( "hg2",          0x2000, 0x2000, 0x9133f804 )
  247.  
  248.     ROM_REGION( 0x0220, REGION_PROMS )
  249.     ROM_LOAD( "hgb3",         0x0000, 0x0020, 0x629cebd8 )    /* palette */
  250.     ROM_LOAD( "hgb5",         0x0020, 0x0100, 0xdbaa4443 )    /* char lookup table */
  251.     ROM_LOAD( "hgb1",         0x0120, 0x0100, 0x07c607ce )    /* sprite lookup table */
  252. ROM_END
  253.  
  254.  
  255.  
  256. GAME( 1984, higemaru, 0, higemaru, higemaru, 0, ROT0, "Capcom", "Pirate Ship HigeMaru" )
  257.